package pkg

import (
	"fmt"
	"os"

	"strconv"

	"github.com/EDDYCJY/go-gin-example/pkg/openai/aijieyun/pkg/services/aecs"
	"github.com/EDDYCJY/go-gin-example/pkg/openai/aijieyun/pkg/services/avpc"
	"github.com/EDDYCJY/go-gin-example/pkg/setting"
)

func Setup() {
	// 从配置文件中读取参数
	accessKeyId := setting.OpenAiSetting.AccessKeyId
	accessKeySecret := setting.OpenAiSetting.AccessKeySecret
	endpoint := setting.OpenAiSetting.Laasendpoint
	laasECSport := strconv.Itoa(setting.OpenAiSetting.LaasECSport)
	// port = "8788"
	_, err := aecs.InitDefaultClient("Southwest08", accessKeyId, accessKeySecret, endpoint, laasECSport, true, os.Stdout)
	if err != nil {
		fmt.Printf("failed to init default ecs client %v", err)
	}
	laasnetport := strconv.Itoa(setting.OpenAiSetting.Laasnetport)
	_, err = avpc.InitDefaultClient("Southwest08", accessKeyId, accessKeySecret, endpoint, laasnetport, true, os.Stdout)
	if err != nil {
		fmt.Printf("failed to init default net client %v", err)
	}
}
